<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="renderer" content="webkit">
        <title>恒信汽车用品后台管理系统</title>
        <!--[if lt IE 9]>
        <script type="text/javascript">
        var e=("abbr,article,aside,audio,canvas,datalist,details,"+
        "figure,footer,header,hgroup,mark,menu,meter,nav,output,"+
        "progress,section,time,video").split(',');
        for(var i=0;i<e .length;i++){
        document.createElement(e[i]);
        }
        </script>
        <script src="/js/html5shiv.min.js"></script>
        <script src="/js/respond.min.js"></script>
        <![endif]-->
        <!--框架 及 插件--->
        <script src="js/jquery.js"></script>
        <link href="js/bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="js/bootstrap/css/font-awesome.css" rel="stylesheet">
        <script src="js/bootstrap/js/bootstrap.js"></script>
        <script type="text/javascript" src="js/jquery.cookie.js"></script>
        <style>
            html {
                height: 100%;
            }
            .login {
                max-width: 347px;
                min-height: 340px;
                margin: auto;
                border: 1px solid #ddd;
                font-size: 16px;
                background-color: #fff;
                -moz-background-clip: border; /* Firefox 3.6 */
                -webkit-background-clip: border; /* Safari 4? Chrome 6? */
                background-clip: border-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */
                -moz-background-clip: padding; /* Firefox 3.6 */
                -webkit-background-clip: padding; /* Safari 4? Chrome 6? */
                background-clip: padding-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */
                -moz-background-clip: content; /* Firefox 3.6 */
                -webkit-background-clip: content; /* Safari 4? Chrome 6? */
                background-clip: content-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */
            }
            .login > img {
                width: 100%;
            }
            .input-group-addon {
                background-color: transparent;
                border: 1px solid #cccccc;
                min-width: inherit;
                box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
            }
            .input-group .form-control:last-child, .input-group-addon:last-child, .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group > .btn, .input-group-btn:last-child > .dropdown-toggle, .input-group-btn:first-child > .btn:not(:first-child), .input-group-btn:first-child > .btn-group:not(:first-child) >
            .btn {
                border-left: none;
            }

        </style>
    <script type="text/javascript">
	$().ready(function() {
		if ($.cookie("rmbUser") == "true") {
			$("#ck_rmbUser").attr("checked", true);
			$("#user_id").val($.cookie("user_id"));
			$("#password").val($.cookie("password"));
			$("#fromEntity").val($.cookie("fromEntity"));
			if (null != $.cookie("project_code"))
				$("#project_code").val($.cookie("project_code"));

		}

		$("body").keypress(function(e) {
			if (e.which == 13) {
				check();
				return false;
			}
		});
	});

	function check() {
		var a = document.getElementById("user_id").value.length;
		var b = document.getElementById("password").value.length;
		if (a == 0) {
			document.getElementById("errorinfo").style.display = "block";
		} else if (b == 0) {
			document.getElementById("errorinfo2").style.display = "block";
		} else {
			var checked = document.getElementById("ck_rmbUser").checked;
			if (checked) {
				var str_username = $("#user_id").val();
				var str_password = $("#password").val();
				var str_fromEntity = $("#fromEntity").val();
				$.cookie("rmbUser", "true", {
					expires : 365
				});
				$.cookie("user_id", str_username, {
					expires : 365
				});
				$.cookie("password", str_password, {
					expires : 365
				});
				$.cookie("fromEntity", str_fromEntity, {
					expires : 365
				});
			} else {
				$.cookie("rmbUser", "false", {
					expire : -1
				});
				$.cookie("user_id", "", {
					expires : -1
				});
				$.cookie("password", "", {
					expires : -1
				});
				$.cookie("fromEntity", "", {
					expires : -1
				});

			}
			login();
		}
	}

	function login() {
		$.ajax({
			type : "POST",
			url : "sys/login",
			dataType : "json",
			data : {
				"user_id" : $("#user_id").val(),
				"password" : $("#password").val(),
				"project_code" : $("#project_code").val()
			},
			success : function(data) {
				if (data.optFlag == "Y") {
					location.href='index.html';
				} else {
					$("#errorinfo3").html(data.optDesc);
					$("#errorinfo3").show();
				}
			}
		});

	}

	

	function cleantip_user() {
		document.getElementById("errorinfo").style.display = "none";
		document.getElementById("errorinfo3").style.display = "none";
	}
	function cleantip_pwd() {
		document.getElementById("errorinfo2").style.display = "none";
		document.getElementById("errorinfo3").style.display = "none";
	}
</script>
</head>
<body style="height: auto !important;width:100%; background-color:#fff;">
	<div
		style="position:absolute;left:0px; right:0px; top:0px; bottom:0px; width:100%; height:100%;">
		<div class="container">
			<div class="row">
				<div class="navbar navbar-default" id="navbar"
					style="background-color: #fff;">
					<div class="navbar-container" id="navbar-container">
						<div class="navbar-header pull-left"
							style="padding:15px 0px 15px 30px;">
							<img src="images/icon2.png" width="173"
								 /> <font
								style="font-size:26px; line-height:36px; margin-left:30px;">恒信汽车用品后台管理系统</font>
						</div>
					</div>
				</div>
				<div class="col-lg-12 col-xs-12" style="margin:50px auto;">
					<div class="row">
						<div class="col-md-12">
							<div class="login">
								<div style="margin:auto; padding:20px 40px; ">
									<p
										style="padding:20px 0 0px 0px; font-weight:bold; color:#636465;">用户登录</p>
									<form class="form-horizontal">
										<div class="row">
											<div class="col-xs-12">
												<div class="form-group">
													<div class="input-group">
														<span class="input-group-addon"><span
															class="glyphicon glyphicon-tasks"></span> </span> <select
															id="project_code" name="project_code"
															class="form-control">
															<option value="hxoms">恒信汽车用品后台</option>
														</select>
													</div>

												</div>
											</div>
											<div class="col-xs-12">
												<div class="form-group">
													<div class="input-group">
														<span class="input-group-addon"><span
															class="glyphicon glyphicon-user"></span> </span> <input
															type="text" name="user_id" class="form-control"
															id="user_id" onfocus="cleantip_user()" placeholder="用户名">

													</div>

												</div>
											</div>
											<div class="col-xs-12">
												<div class="form-group">
													<div class="input-group">
														<span class="input-group-addon"><span
															class="glyphicon glyphicon-lock"></span> </span> <input
															type="password" id="password" name="password"
															class="form-control" id="password" placeholder="登录密码"
															onfocus="cleantip_pwd()">

													</div>
												</div>
											</div>
											<div align="center" style="color:red;">
												<i style="display:none" id="errorinfo3">用户名或密码错误</i> <i
													style="display:none" id="errorinfo2">*密码不能为空</i> <i
													style="display:none" id="errorinfo">*用户名不能为空</i>
											</div>
											<div class="col-xs-6"
												style="padding:20px 10px; text-align:center;">
												<button class="form-control btn btn-danger " type="button"
													onclick="check();">登 录</button>
											</div>
											<div class="col-xs-6"
												style="padding:20px 10px; text-align:center;">
												<button class="form-control btn btn-default"
													onclick="document.forms[0].reset();" type="button">重
													置</button>
											</div>
											<div class="col-xs-12" style="font-size:12px;">
												<input type="checkbox" id="ck_rmbUser" checked="checked" />记住用户名
											</div>
										</div>
									</form>

								</div>
							</div>

						</div>
					</div>
				</div>
				<div class="col-sm-12 hidden-xs"
					style="border-top:1px solid #ccc; color:#969A9C; line-height:80px; text-align:center;">恒信德龙实业有限公司
					版权所有</div>
			</div>
		</div>
	</div>

    </body>
</html>
